import { createApp } from "vue";

import App from "@/App.vue";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
//@ts-expect-error忽略当前文件ts类型的检测否则有红色提示(打包会失败)
import zhCn from "element-plus/dist/locale/zh-cn.mjs";
import "virtual:svg-icons-register";
import "@/styles/index.scss";
import router from "./router";
import pinia from "@/store";

const app = createApp(App);
import gloablComponent from "./components/index";

import vSlideIn from "@/util/vSlideIn.ts";

app.directive("v-slide-in", vSlideIn);

app.use(ElementPlus, {
  locale: zhCn
});
app.use(router);
app.use(pinia);
app.use(gloablComponent);
app.mount("#app");

// //防抖和节流
// //防抖
// function debounce(func, wait) {
//   let timeout;
//   return function(...args) {
//     let context = this;
//     clearTimeout(timeout);
//     timeout = setTimeout(() => func.apply(context, args), wait);
//   };
// }
//
// //节流
// function throttle(func, wait) {
//   let lastTime;
//   return function(...args) {
//     let now = Date.now();
//     if (now - lastTime >= wait) {
//       lastTime = now;
//       func.apply(this, args);
//     }
//   };
// }